﻿using HenuAlbum.Identity;
using Microsoft.AspNetCore.Identity;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;

namespace HenuAlbum.Models
{
    public class Resource
    {
        public Guid Id { get; set; }

        [Required]
        public int AlbumId { get; set; }

        [Required]
        public Album Album { get; set; }

        [Required]
        public int UploaderId { get; set; }

        [Required]
        public User Uploader { get; set; }

        [Required]
        [StringLength(32)]
        public string Title { get; set; }

        [Required]
        [StringLength(512)]
        public string Description { get; set; }

        /// <summary>
        /// 照片拍摄日期(活动日期)
        /// </summary>
        [DataType(DataType.Date)]
        public DateTime? ShootingDate { get; set; }

        /// <summary>
        /// 照片拍摄地点(活动地点)
        /// </summary>
        [StringLength(32)]
        public string Location { get; set; }

        [Required]
        public DateTime CreateTime { get; set; }

        [Required]
        [StringLength(256)]
        public string UploadFileName { get; set; }

        [Required]
        [StringLength(64)]
        public string DiskFileName { get; set; }

        [Required]
        [StringLength(16)]
        public string FileExtension { get; set; }

        [Required]
        public long FileSize { get; set; }

        [Required]
        public ResourceType Type { get; set; }

        public List<ResourceTag> Tags { get; set; } = new List<ResourceTag>();

        public bool IsLocked { get; set; } = false;

        public int DownloadCount { get; set; }
    }
}
